﻿using System;
using System.Text;

namespace PSatSimCom
{
    public class RandomSingleton
    {
        private static readonly Random OneRand;

        public static int Seed { get; private set; }
        public static Random Rand { get { return OneRand; } }

        static RandomSingleton()
        {
            Seed = (int)DateTime.Now.ToFileTime();
            OneRand = new Random(Seed);
        }

        public static string RandomString(int size)
        {
            var builder = new StringBuilder();

            for (var i = 0; i < size; i++)
            {
                var ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * Rand.NextDouble() + 65)));
                builder.Append(ch);
            }

            return builder.ToString();
        }
    }
}
